property pScene, pScene2 -- reference to the 3D member
property pbox, pbox2 -- reference to the box model
property x,y, polepos, myVector, myVector2, myTargetCast1, myTargetCast2
on getBehaviorDescription me
return \
"Simulates 3D desktop transition, similar to fast user switching/OS X user switching"
end getBehaviorDescription
on getBehaviorTooltip me
return \
"Use with Shockwave 3D Media Element. " & \
"& 1024x768 desktop pictures."
end getBehaviorTooltip
on beginSprite me
x=0
y=0
-- define p3dMember
pScene = sprite(me.spriteNum).member
-- reset the 3D world
pScene.resetWorld()
-- create the model resource for the box
boxResource = pScene.newModelResource("boxResource", #box, #back)
boxResource.height = 768
boxResource.width = 1024
boxResource.length = 0
pbox = pScene.newmodel("box", boxResource)
boxResource2 = pScene.newModelResource("boxResource2", #box, #back)
boxResource2.height = 768
boxResource2.width = 1024
boxResource2.length = 0
pbox2 = pScene.newmodel("box2", boxResource2)
---
myVector = vector(-500, 0, 0)
myVector2 = vector(500, 0, 0)
---
-- create texture for box
pScene.newtexture("boxTexture", #fromCastmember, member(myTargetCast1))
pScene.newtexture("boxTexture2", #fromCastmember, member(myTargetCast2))
-- create shader for box
pScene.newshader("boxShader", #standard)
pScene.shader("boxShader").texture = pScene.texture("boxTexture")
pbox.shaderList[1] = pScene.shader("boxShader")
pScene.newshader("boxShader2", #standard)
pScene.shader("boxShader2").texture = pScene.texture("boxTexture2")
pbox2.shaderList[1] = pScene.shader("boxShader2")
end
on exitFrame me
member("Scene").model("box2").visibility=#none
member("Scene").model("box").rotate(myVector, vector(0,1,0), 4, #world)
y=y+2
if y>=40 then
member("Scene").model("box2").visibility=#front
if x=0 then
member("Scene").model("box2").rotate(myVector2, vector(0,1,0), -90, #world)
x=1
else
member("Scene").model("box2").rotate(myVector2, vector(0,1,0), 4, #world)
end if
end if
if y>=88 then go the frame+1
if y= 84 then member("Scene").model("box").visibility=#none
end
on isOKToAttach (me, aSpriteType)
tIsOk = 0
if aSpriteType= #graphic then
tIsOK = 1
end if
return(tIsOK)
end on
on getPropertyDescriptionList me
return \
[ \
#myTargetCast1: \
[ \
#comment: "Member 1", \
#format: #variable, \
#default: "desktop_pict1" \
], \
#myTargetCast2: \
[ \
#comment: "Member 2", \
#format: #variable, \
#default: "desktop_pict2" \
] \
]
end getPropertyDescriptionList