How can I make a Coordinates Object Dynamic in JavaScript?
I'm using lines a module for Titanium Appcelerator to draw lines. In lines
you just need 2 Object with coordinates to draw a line (start and end
point).
I want to modify the start/end point object with a 'touchmove' event,
However I'm fairly new with JavaScript and I just can't figure it out the
right way to do it.
var lines = require('com.lines'); //<< Import lines module
var attrib = {
color:'red',
touchEnable:true,
thickness:20
};
var from = {x:20,y:100}; //<< Start Point Object Coordinates
var to = {x:200,y:100}; //<< End POint Object Coordinates
var lineOne = lines.createLine(from, to, attrib); //<<Creates lineOne var
with attributes
win.add(lineOne); //Draw the line.
I have no problem moving the whole line using the lineOne variable,
however as I said I can't found a way to modify the objects dynamically.
thanks!
No comments:
Post a Comment