# Excel Animation Tutorial – 2D Wire-frame House #2 (adding rotation)

This is a continuation tutorial, the second in the wire-frame tutorial series. Here we take the 2D basic house we created on an 2D scatter chart and introduce rotation. These basic tutorials use elementary math/geometry and trigonometry (middle school and high school level). As the series progresses, the tutorials will reach 3D level and the creation of more complex shapes and landscapes (i.e. roller coaster and beyond).
Thanks for your support!

0:00
hello my friends and welcome back today
0:02
we will be continuing our
0:04
introduction in wireframe animation with
0:08
this house this animated two-dimensional
0:11
house
0:12
which
0:13
i saw some comments on the
0:19
on my comment section and they say this
0:21
is for entertainment it’s not for
0:22
entertainment this will lead to a
0:25
roller coaster or more complex 3d pro
0:28
projects in the previous tutorial we
0:32
built this to the house
0:34
and we added some
0:37
scaling
0:38
as you can see here i’m clicking on
0:45
on these buttons
0:47
0:53
i added translation along the x-axis
0:56
and translation along the y-axis
1:01
and also added an animation
1:05
you can see the house moving
1:07
on a pattern resembling number eight
1:12
and again you can adjust these
1:13
parameters to move on a circle or on
1:16
some random curves
1:18
what i did before i started this
1:20
recording is i copied this sheet one
1:23
into an identical sheet sheet2
1:27
right now i just need to readjust
1:32
assign the macro the proper macro
1:34
because when you copy
1:36
the new button that you create
1:38
has the old old macro so associated with
1:43
it so
1:44
right now
1:46
you see is running
1:51
all the buttons work correctly
1:54
and we are trying to do rotation i
1:56
1:58
mark here x y the
2:00
label of the columns and rotate it
2:04
and in order to understand the formulas
2:06
i’m going to my website here you can go
2:08
to just anywhere on google type rotation
2:11
formula rotation
2:13
2d rotation stuff like this i
2:17
type the rotation in the search box
2:20
and i hit it return
2:25
and since i use this a lot uh i know
2:29
most of them has
2:31
have this formula here if you if you
2:33
look all of them but there’s a few
2:35
places that have the
2:37
the derivation
2:39
and the derivation is
2:43
the best derivation i think this this
2:45
quite a few
2:47
blog posts they had the derivation but
2:49
the derivation i use is this one you can
2:52
click on pdf view
2:54
and it shows you if you have a
2:56
straight triangle
2:58
not straight triangle or right triangle
3:01
with 190 degree angle right here
3:04
and if you
3:06
label this the length of these
3:09
sides a b and c
3:12
so c is the hypotenuse a and b are the
3:14
catheters
3:16
and the definition of sinus here is
3:19
alpha right here i forgot to put it but
3:21
sine of alpha is equal to b
3:24
so the opposite
3:26
side of triangle
3:28
and divided by hypotenuse the opposite
3:32
cos of alpha is the near catheter a over
3:36
c over the hypotenuse
3:38
and i i did a small derivation here
3:41
and i reached these formulas
3:44
so
3:45
function of the old components
3:48
the old coordinates of a certain point
3:50
if you rotate the point
3:52
keeping the distance to the origin
3:54
constant you get this formula function
3:56
the so the new
3:58
x and y components facts function of the
4:01
old x and y components and function the
4:04
uh
4:05
of the angle alpha rotation
4:09
so i will
4:10
show you this a little bit here
4:13
i open the
4:16
photoshop
4:18
with a blank
4:20
page here
4:23
so
4:24
what i claim is if you have a
4:29
system of coordinates
4:31
x
4:33
y
4:35
x has a unit vector of i okay you need
4:39
vector
4:40
and y
4:42
has a unit vector of
4:44
j
4:45
okay
4:46
j
4:48
if you have a point here right here p
4:51
okay
4:52
and this is a position vector so o
4:55
origin o
4:56
so o p
4:59
is a vector
5:00
let’s call it the p vector position
5:02
vector okay
5:04
if you rotate this clockwise
5:09
in my
5:11
on my blog
5:14
you you see a rotation of
5:15
counterclockwise counterclockwise is the
5:18
standard trigonometric rotation positive
5:20
rotation
5:21
the proper trigonometric sign convention
5:25
rotate rotating clockwise is negative of
5:29
that
5:30
but i use the
5:32
clockwise because excel has a formula
5:34
that
5:35
stands for clockwise rotation
5:38
so it’s very easy to translate between
5:40
the two but
5:42
that’s why i use clockwise
5:44
clockwise rotation okay so you’re
5:46
rotating from from p to p
5:49
prime
5:52
and if this is the
5:54
the coordinate of p
5:58
is equal to x y
6:00
the coordinate of p prime
6:03
with equal will be equal to x prime
6:08
and y prime
6:13
if the angle is small
6:16
x prime is going to be a little bit
6:18
longer than
6:19
larger than x and y prime will be a
6:21
little bit shorter than y
6:24
so
6:27
what i claim is that x prime
6:30
is equal to
6:32
x
6:33
times let’s call this angle of theta
6:37
cos of theta
6:40
is a little bit longer so we need to add
6:42
something plus
6:45
y
6:46
times sine
6:49
of theta
6:52
and y prime
6:54
is equal to
6:56
y cos of theta
6:58
with a plus
7:00
so y
7:02
cos of
7:04
data
7:06
minus this is smaller okay
7:08
x
7:10
sine of theta so having this in mind
7:13
and again you can go to any website any
7:16
anywhere on the internet just type 2d
7:19
rotation formulas the two-dimensional
7:21
rotation formulas
7:23
and you get here so
7:25
sine
7:27
the sine function is like something like
7:29
this
7:30
okay
7:32
and the
7:33
so this is sine
7:36
sine of x
7:39
x
7:40
and cosine
7:42
is exactly like science except except
7:45
these uh
7:46
d phase a little bit is like this
7:55
these are harmonic functions they’re
7:56
very very important so this is
7:59
if this is x
8:01
this is cos of x
8:04
that’s how it looks like
8:06
first we go here at the
8:08
parameters and type
8:11
data
8:13
so angle theta
8:15
or you can say rotation okay
8:23
and let’s put for now zero let’s go in
8:26
developer
8:28
okay
8:29
design mode
8:31
copy this
8:32
ctrl c ctrl v
8:36
and place it right here
8:40
property
8:43
let’s call this
8:46
i wouldn’t call it rotation because
8:48
rotation might be a
8:50
reserved word it is the reserved word so
8:53
let’s call it data
8:56
data
8:57
and let’s go from
8:59
0 to
9:02
it’s 360 degrees
9:05
so from 0 to 36
9:17
and double click on it
9:20
and fill it out so let’s say
9:23
bb1 in square brackets
9:26
b1
9:28
is equal to
9:32
that’s the normal
9:33
engineering convention you put a
9:35
multiplier in front of math convention
9:38
so let’s check if it works we need first
9:41
to get out of design mode by clicking
9:43
here
9:44
or
9:45
clicking right here the same thing
9:48
and
9:49
you see
9:50
it runs from zero
9:54
to
9:54
all the way to
9:56
360.
9:59
and i want to do a how do you say
10:02
uh rollover feature add the role of the
10:06
feature but for now let’s just implement
10:08
formulas here
10:10
this one x
10:13
we open photoshop here
10:15
x is equal to x the old x x prime is
10:18
equal to
10:20
let’s uh label this x prime and y prime
10:23
okay
10:25
prime
10:27
and y prime
10:33
yeah my my keyboard is
10:35
it’s dark i cannot see
10:38
so
10:39
so this is equal to
10:44
x
10:45
times
10:46
cos
10:48
of
10:50
pick up this value and absolute
10:52
reference it okay absolute reference it
10:58
so hit f4 once and you get dollar sign
11:01
in front of the
11:03
uh column and in front of the row
11:06
so now we need when we copy right and
11:09
right or left or down or up
11:12
this will be firmly
11:15
fixed there
11:19
another thing i want to do is
11:22
um
11:24
these functions accept don’t accept
11:25
degrees they accept radians so okay so
11:31
the
11:33
11:35
of that
11:38
okay
11:40
okay so is radiance a function
11:43
okay
11:45
it’s not i made a typo here
11:48
so now it’s good so copy this here
11:51
and let’s change something what
11:54
oh wait um
11:57
we need to add something here
12:00
plus y sine of
12:03
theta
12:05
so we go
12:09
here
12:11
copy i’m sorry
12:13
copy this
12:15
ctrl c
12:18
plus
12:20
ctrl v
12:21
so d11 is gonna be e11 here okay
12:26
e11 and here’s sine
12:31
okay
12:33
let’s now copy this to the right
12:39
we need to move this reference here or
12:42
we could have put dollar sign in front
12:43
of the column
12:45
hit return to save this and then go here
12:48
and say let’s look at
12:51
formula
12:52
minus sine plus cos okay so
12:57
where is it
13:01
this is
13:06
with minus
13:11
and here plus cos
13:17
and
13:18
now
13:20
first i want to add
13:25
another data
13:27
series
13:28
13:30
let’s take
13:33
this
13:34
for x
13:36
and take
13:39
this
13:43
for y
13:47
let me see
13:48
40
13:51
40 40 okay
13:57
and let’s copy this down
14:01
and see if it if it’s correct
14:04
yeah it looks right
14:06
i tell you why
14:10
if i go and
14:16
let’s make it green
14:19
so go here to feel
14:21
and
14:24
make it a nice green let’s say maybe
14:26
this is too light
14:28
let’s make it darker like
14:31
like this green okay
14:33
and i think the thickness is three
14:36
i’m not sure how much it is
14:39
two and a half maybe
14:41
let me see
14:43
click on this
14:46
three right so
14:48
let’s make it three
14:51
okay and now let’s copy down
14:56
so we saw in the previous tutorial that
15:00
we need to delete certain uh
15:02
points in the data otherwise we get
15:05
artifacts
15:06
so we delete just like the other ones
15:09
wherever we see black here in the
15:12
previous formulas in the previous
15:14
columns we deleted okay
15:16
check out all the artifacts disappear
15:19
we can increase the angle check this out
15:24
okay let’s do let’s continue deleting
15:27
these artifacts
15:29
okay so now
15:34
okay
15:35
so it goes from zero
15:39
to
15:43
360.
15:45
i would like to implement a rollover
15:47
feature
15:48
so
15:49
in order to implement this rollover
15:52
i will first go to developer
15:56
visual basic
15:58
and
16:02
actually
16:04
go in design mode
16:07
properties
16:10
let’s go between uh decrease the zero by
16:13
minus one
16:14
okay
16:16
by one so instead of zero to 36 it goes
16:20
to minus -1
16:22
the maximum is good usually we have to
16:24
increase it but
16:26
since 36 is equal to zero so 360 degrees
16:29
and zero are the same thing we leave it
16:31
like this and we go then to
16:35
double click on this we go here
16:37
and say
16:42
if
16:44
data
16:46
is eq
16:47
is greater than
16:49
let me see greater
16:52
than
16:54
35
16:55
then
16:58
data
17:00
is equal to zero
17:04
actually let’s put it in the data is
17:06
greater than 36
17:09
or equal i think is like this
17:13
equal or greater than 36 then theta is
17:16
zero oh if theta is smaller than
17:22
zero
17:23
then theta is going to be
17:27
35
17:28
okay
17:30
and check this out now
17:32
before it was limiting be between 0 to
17:35
35 between 0 the rotation because we
17:38
multiply by 10 between 0 and 3
17:41
160
17:42
so now exit design mode we can use the
17:45
button check this out go go go go go go
17:48
go we are at 340 350
17:52
click again goes to zero
17:54
so we can just hold this button
17:57
and describe
17:58
circles after circle of the circle or
18:01
hold the other button
18:04
and go
18:05
down i mean decreasing and when it goes
18:07
to
18:09
10 0 instead of going to negative number
18:13
or staying there it goes to 350.
18:16
so we can
18:18
rotate over and over as many times as we
18:22
want
18:22
for angles i always add
18:26
this rollover feature and i will say
18:29
go over go to google
18:32
and type how to rotate or rotation
18:36
formula for two dimensional
18:38
so 2d rotation formulas or you go to my
18:41
blog
18:43
and again type rotation and follow the
18:45
tutorials derive the equation
18:48
the the the system of equations
18:51
these are the first steps in order to
18:53
build a roller coaster like you guys
18:55
asked me i want to learn how to
18:57
how to do that
18:59
so follow these tutorials if you are
19:01
beside i i bet
19:03
99 of people are not interested they
19:05
just
19:06
throw a look here at the channel the
19:08
video
19:09
this is not meant to be entertaining
19:12
about subscription everybody says
19:14
subscribe to my channel i’ll say do not
19:16
subscribe to my channel unless you’re
19:18
highly interested
19:20
i would advise that you if you’re mildly
19:22
interested visit occasionally okay
19:26
it’s better to for somebody to to have
19:28
the attitude why didn’t i visit this
19:31
more often than the attitude hey i’m
19:34
getting all these
19:36
alerts why did i subscribe to this guy
19:38
so i prefer to have fewer people but
19:41
more enthusiastic
19:43
again feel free to subscribe if you want
19:45
but definitely i would not advise you to
19:48
hit the notification bell
19:50
because then you’re going to be annoyed
19:51
every time i post something you’re going
19:53
to be annoyed i will say
19:55
once in a while not
19:57
youtube will not notify you okay
20:00
we’ll give you an alert but if you don’t
20:02
hit the notification bell
20:04
you’re not going to be bothered i mean
20:06
nagged by this repeated
20:09
over and over notification so
20:12
let’s uh play a little bit more with
20:14
this
20:16
i will say
20:33
see while i’m running the macro
20:36
i rotate
20:37
the house
20:38
we can go in
20:40
the macro itself
20:42
and
20:44
here sheet two
20:50
and b1
20:56
b1
21:02
is equal to
21:06
let’s copy one of these
21:11
ctrl c
21:14
i would like to rotate it uh sine sine
21:17
goes between zero minus one to one
21:20
so let’s rotate this by um
21:24
180
21:26
so it goes from minus 180 to plus 180 so
21:29
and this is a little bit slower rotation
21:31
so let’s put here 7 instead of 20.
21:36
check this out now
21:45
let’s also add add some automation to
21:47
the scale
21:48
so this is b3 maybe yeah b3
21:56
b3 from -1 to 1 that’s okay
22:00
um
22:00
[Music]
22:03
let’s put 12 here
22:07
so now you have everything you have
22:09
translation rotation
22:11
scaling and
22:13
yeah two different translations one
22:15
rotation one scaling
22:18
so that’s how the coaster is done i mean
22:20
the formulas are a little bit more
22:22
22:23
we will get to them pretty soon
22:26
in a few tutorials i would say probably
22:28
in
22:29
5 10 tutorials maximum we get straight
22:32
to the roller coaster maybe not even
22:34
that much 5 not 10.
22:37
and this being said thank you for your
22:39
attention