Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manupulate existing shapes #34

Open
dicoy-zz opened this issue May 4, 2014 · 9 comments
Open

Manupulate existing shapes #34

dicoy-zz opened this issue May 4, 2014 · 9 comments

Comments

@dicoy-zz
Copy link

dicoy-zz commented May 4, 2014

Is there a way to delete or modify a shape you just created
I did this:
tile = iso.add(new Path([Point(0,2,0),Point(1,2,0),Point(1,3,0),Point(0,3,0)]), new Color(50,160,60));

in hopes of being able to do stuf like this:
tile.remove();
iso.remove(tile);
iso.shapes.tile.x = 3;
tile.extrude(3, new Color(50,160,60));

@JrFolk
Copy link

JrFolk commented May 5, 2014

Instead of constructing directly into iso.add(), you can construct the items and push them into an array:

tile = new Path(args);
scenery.push(tile);

function render(){
for(var piece in scenery)
iso.add(scenery[piece]);
}

Then you can change the properties of tile, and invoke 'render()'.

@dicoy-zz
Copy link
Author

dicoy-zz commented May 5, 2014

is that how the animation is done on the homepage?

On Sun, May 4, 2014 at 9:29 PM, JrFolk [email protected] wrote:

Instead of invoking directly into iso.add(), you can construct the items
and push them into an array:

tile = new Path(args);
scenery.push(tile);

function render(){
for(var piece in scenery){
iso.add(scenery[piece]);
}
}

Then you can change the properties of tile, and invoke 'render()'.


Reply to this email directly or view it on GitHubhttps://github.com//issues/34#issuecomment-42152133
.


Probaste Pensando??
Sumate al desafio Sebastian!!
Proba usando tu cerebro durante 14 dias, si no te gusta... segui mirando
Tinelli.

@JrFolk
Copy link

JrFolk commented May 5, 2014

Nope. On the homepage, the spinning diamond shape is first created, then a center of rotation point is constructed, then the diamond is rotated around that point by a certain angle (this is what changes each frame) and then passed to iso.add(), all in one statement. This is done every frame.

@dicoy-zz
Copy link
Author

dicoy-zz commented May 5, 2014

Thankyou very much!! :)

Do you have the code for the diamond so I can get a better grip?

On Sun, May 4, 2014 at 10:11 PM, JrFolk [email protected] wrote:

Nope. On the homepage, the spinning diamond shape is first created, then a
center of rotation point is constructed, then the diamond is rotated around
that point by a certain angle (this is what changes each frame) and then
passed to iso.add(), all in one statement. This is done every frame.


Reply to this email directly or view it on GitHubhttps://github.com//issues/34#issuecomment-42153095
.


Probaste Pensando??
Sumate al desafio Sebastian!!
Proba usando tu cerebro durante 14 dias, si no te gusta... segui mirando
Tinelli.

@JrFolk
Copy link

JrFolk commented May 5, 2014

It's on the homepage if you click 'GALLERY' and scroll down to the bottom.
click on:
image
And you'll be able to edit it all piece by piece.

@dicoy-zz
Copy link
Author

dicoy-zz commented May 5, 2014

thankyou so much!! :)

On Sun, May 4, 2014 at 10:21 PM, JrFolk [email protected] wrote:

It's on the homepage if you click 'GALLERY' and scroll down to the bottom.
click on:
[image: image]https://cloud.githubusercontent.com/assets/3434590/2874631/8348e592-d3f3-11e3-999e-cfd1dfa80b8b.png
And you'll be able to edit it all piece by piece.


Reply to this email directly or view it on GitHubhttps://github.com//issues/34#issuecomment-42153323
.


Probaste Pensando??
Sumate al desafio Sebastian!!
Proba usando tu cerebro durante 14 dias, si no te gusta... segui mirando
Tinelli.

@dicoy-zz
Copy link
Author

dicoy-zz commented May 5, 2014

Las question (I might as well...)
How/where does the conversion of coorditanes (from canvas coordinates to
isomer's grid) happen?

I'm trying to find out what I'm clicking on

On Sun, May 4, 2014 at 10:52 PM, Seba Manda [email protected] wrote:

thankyou so much!! :)

On Sun, May 4, 2014 at 10:21 PM, JrFolk [email protected] wrote:

It's on the homepage if you click 'GALLERY' and scroll down to the bottom.
click on:
[image: image]https://cloud.githubusercontent.com/assets/3434590/2874631/8348e592-d3f3-11e3-999e-cfd1dfa80b8b.png
And you'll be able to edit it all piece by piece.


Reply to this email directly or view it on GitHubhttps://github.com//issues/34#issuecomment-42153323
.


Probaste Pensando??
Sumate al desafio Sebastian!!
Proba usando tu cerebro durante 14 dias, si no te gusta... segui mirando
Tinelli.


Probaste Pensando??
Sumate al desafio Sebastian!!
Proba usando tu cerebro durante 14 dias, si no te gusta... segui mirando
Tinelli.

@JrFolk
Copy link

JrFolk commented May 5, 2014

I haven't dug that deep till now, but I think the 'magic' happens in the file:
/isomer/js/isomer.js

In the function:
"Isomer.prototype._translatePoint = function (point)"

As the comments put it:
"X rides along the angle extended from the origin
Y rides perpendicular to this angle (in isometric view: PI - angle)
Z affects the y coordinate of the drawn point"

'the angle' comes from 'this.angle' which is defined as π/6 = 30° in the same file.
It seems the z is translated directly.

@dicoy-zz
Copy link
Author

dicoy-zz commented May 5, 2014

I saw that as well, z translate directly to the canvas's Y (the higher isomer's Z is, the lower the canvas's Y)

I'm really close, but any way I use _translatePoint, I still can't get a conversion that's seems good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants