Articles Tagged "Tutorial"

Rotated Oval Tutorial

rotated oval

Making the transition from drawing circles to drawing ovals is pretty simple but when you need to go from drawing ovals to drawing rotated ovals, you might run into a few problems. This article documents some of the pitfalls I encountered and presents them as a learning experience. If you just want some solid code to draw rotated ovals or twisted ellipses, skip ahead to the end of the article and copy the last block of code. If you think you might gain from my experience then by all means… read on.
Read More

How to Draw an Oval

Drawing an oval or ellipse is about as easy as drawing a circle with ActionScript. When drawing a circle you only need one measurement for the circle’s radius but when drawing an oval you need to provide 2. One for the Width of the oval and one for its Height. But before I get too far ahead, let’s take a look at the basic circle drawing code used to draw a simple circle
Read More

Hexadecimal Color Fading Array

A while ago I wrote a Hexadecimal Color Fading Tutorial explaining how to select a single color at any point on a gradient between two specified colors. In that tutorial there was a function which efficiently broke each of the 2 specified colors into their Red, Green and Blue components and then calculated a single new color at a specified point between them.

Here's what the code looks like: ...
Read More

How to Draw a Logarithmic Spiral

What is a Logarithmic spiral? A logarithmic spiral steps around center at an additive rate while stepping away from center at a multiplicative rate. Increasing the distance from center at a multiplicative rate causes the arm of a logarithmic spiral to increase in size as it gets further from center. To illustrate, take a look at this photo of a spiral staircase:

bottom-up view
Photo by: darijus

As you can see in the above photo, the number of steps
Read More

How to Draw a Spiral

This tutorial covers the basic concepts needed to draw a simple spiral with ActionScript. A “simple spiral” or an “Archimedean spiral” is created by moving ‘away from’ and ‘around‘ a central point at a constant additive rate. If that sounds a bit foreign to you, don’t worry it’s nothing new. If you’ve coiled a hose or rope on a flat surface, you have experience working with Archimedean spirals.

Archimedean Spiral
(Photo by Paul Needham)

The most notable characteristic of the simple spiral above is that each coil (a full rotation around center) will always increase the spiral’s radius by the same amount (the width of the rope).

Now that you understand what a simple spiral is, I’d like to jump ahead a bit and show you the final state of our code:
Read More

How to Swing a Pendulum Arc

In my previous article explaining How to Draw an Arc with ActionScript a few readers asked how to simulate the swing of a pendulum or the swaying motion of a falling leaf. Hopefully this tutorial will add a little insight into that process. The technique I’ll be using won’t mimic the effects of gravity but will be more similar to the metered swing of a clock’s pendulum or a large carnival ride.

Observations
: Before we start writing any code, let’s make a few general observations. If you were to swing a pendulum from right to left, you could note the following:

  1. Once the pendulum is dropped or released, it begins to pick up speed as it approaches the bottom of its arc. This gradual acceleration is similar to “Easing In”.
  2. Once the pendulum passes the bottom of its arc, it begins to swing upward and consequently slows down which is similar to “Easing Out”.
  3. Once the pendulum reaches the top of its arc on the left, it begins to swing backwards from left to right. The swing from left to right is a mirror image of the previous swing from right to left.

Conventions: With those observations in mind we can start
Read More

Flash CurveTo Visualization Code

If you’ve ever wondered how Adobe Flash draws a curve when issued a “curveTo” command this article will help you visualize the process.

As you probably know, Flash requires three points to draw an exponential curve.

  1. A Starting Point. Wherever the Flash drawing pen is currently located. If you have not previously moved the pen with “lineTo”, “curveTo”, or “moveTo” the pen defaults to the origin (0, 0).
  2. A Control Point. A point which the the Flash drawing pen will head toward before changing direction and heading toward the end point. The pen generally does not go through the control point unless your “curve” is nearly straight.
  3. An End Point. Where the Flash drawing pen will come to rest when the curve is complete.

But how exactly does the control point “control” the shape of the curve? How does Flash precisely map the vague concept of heading towards a point and then land precisely at another point? Take a look at the SWF file below
Read More

© Sean O'Shell 2007-2024