Vector.js

Vector is an open source javascript library for creating interactive graphics. View the repository, run the tests, or meet the team.

Dependency Relation Open in Sandbox

Description

This interactive demonstrates how two elements can be made dependent on eachother.

Script

/**
* @title Dependency Relation
* @description This interactive demonstrates how two elements can be made dependent on eachother.
* @tags []
* @ignore true
*/
import { Interactive, getScriptName } from '../../index.js';
let interactive = new Interactive(getScriptName());
interactive.width = 768;
interactive.height = 200;
interactive.border = true;
let control1 = interactive.control(100, 50);
let control2 = interactive.control(200, 150);
control2.addDependency(control1);
control2.update = function () {
    this.x += control1.dx;
};
//# sourceMappingURL=dependency-function.js.map