We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › an elipse that half rotates, that's it really
Page Index Toggle Pages: 1
an elipse that half rotates, that's it really (Read 1563 times)
an elipse that half rotates, that's it really
Oct 22nd, 2008, 12:46am
 
I was looking for a Flash alternative when designing my website, silly really as Flash is the only method I know how to program in. I wanted a website that was as HTML as possible as I hate the idea of a prohibitive download. It was suggested that I might be able to do the brief and simple 3D that I wanted in javascript, some examples here:

http://douggreenall.co.uk/site/?p=72
http://ajax3d.sourceforge.net/
http://www.uselesspickles.com/triangles/demo.html

But what I wanted to do was complicated, so somebody suggested Processing. I have seen the example pages and I think it might do what I want, but its very low level and mathematically intensive - a world away from the Flash GUI.

So here is what I would like to achieve - essentially the site would have a 3d looking disc in the centre of it, of which, upon mouse over event, would rotate to bring from behind to the front the program to download. That's it.

Here is a mock up of the site:
http://flickr.com/photos/8-8/2962150678/sizes/o/

And here is a little bit more detail:
http://flickr.com/photos/8-8/2961305193/

First of all can I do this? Secondly how? I don't want to seem like one of those temporary posters that wants their work done for them, but I'm afraid that's exactly the position I find myself in Happy
Re: an elipse that half rotates, that's it really
Reply #1 - Oct 23rd, 2008, 12:03pm
 
you could look at this as a starting point, and hack it from there,

http://processing.org/learning/3d/perspective.html
Re: an elipse that half rotates, that's it really
Reply #2 - Oct 23rd, 2008, 4:34pm
 
Well I never thought I could do it, thanks for the offer I actually enjoyed it! Here is some code which outlines much of the shapes I want and clicking it will move the green shape to the left:


// Learning Processing
// Daniel Shiffman
// http://www.learningprocessing.com

// Exercise 5-8: Example 4-3 in the previous chapter moved a circle across the window. Change the sketch so that the circle only starts moving once the mouse has been pressed. Use a boolean variable.

// Boolean variable starts as false so it does not move
boolean going = false;

// Location of moving circle to start with (stationary)
int circleX = 300;
int circleY = 241;

//size of page
void setup() {
 size(600,600);
 smooth();
}

//background colour
void draw() {
 background(255);
 smooth();

 // Disc
fill(255);
ellipse(300,250,160,30);

// Divider
stroke(0);
line(300,250,300,0);
line(300,300,300,600);

// little dot
fill(0);
ellipse(300,250,3,3);
 
 // Moving circle shape size and colour details
 stroke(0);
 fill(122, 222, 33);
 ellipse(circleX,circleY,22,6);
 
 // Only move the circle when "going" is true
 if (going) {
   //speed of movement
   circleX = circleX - 4;
 }
}

// Set going to true when the mouse is pressed!
void mousePressed() {
 going = true;
}



But I need to:

1. Make the green shape follow a circular track so that it gives the impression of the disc spinning

2. I do not know how to make the bottom curve of the shape to give it a body, like the bezel tool I should think to create a semi-circle I would have to draw two quarters.

Thanks.
Re: an elipse that half rotates, that's it really
Reply #3 - Oct 24th, 2008, 9:16am
 
I got number 2:

 //underbelly
 noFill();
arc(300, 252, 160, 90, PI/90, PI);


Anybody know about number 1?

*Thanks fjen*
Page Index Toggle Pages: 1