public void InterpolateToRestPoseAnimation(double duration, List <SCNNode> ropeShapes) { // use relative tr[ansforms here, these are safer when the catapult gets hit if (duration == 0d) { for (var i = this.BoneInset; i < ropeShapes.Count - this.BoneInset; i++) { var worldTransform = this.restPoseSpace * this.restPoseTransforms[i]; worldTransform.Transpose(); ropeShapes[i].WorldTransform = worldTransform; } } else { SCNTransaction.Begin(); SCNTransaction.AnimationDuration = duration; for (var i = this.BoneInset; i < ropeShapes.Count - this.BoneInset; i++) { var worldTransform = this.restPoseSpace * this.restPoseTransforms[i]; worldTransform.Transpose(); ropeShapes[i].WorldTransform = worldTransform; } SCNTransaction.Commit(); } }
public override void DidOrderIn(PresentationViewController presentationViewController) { SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 1.0f; sceneGraphDiagramNode.Opacity = 1.0f; SCNTransaction.Commit(); }
private void PerformOpenAnimation() { if (!this.isBorderOpen && !this.isAnimating) { this.isBorderOpen = true; this.isAnimating = true; // Open animation SCNTransaction.Begin(); SCNTransaction.AnimationDuration = GameBoard.AnimationDuration / 4f; SCNTransaction.AnimationTimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseOut); this.borderNode.Opacity = 1f; foreach (var segment in this.borderSegments) { segment.Open(); } this.Scale = new SCNVector3(GameBoard.MinimumScale, GameBoard.MinimumScale, GameBoard.MinimumScale); // completion is run on main-thread SCNTransaction.SetCompletionBlock(() => { SCNTransaction.Begin(); this.borderNode.RunAction(this.PulseAction(), "pulse"); this.isAnimating = false; SCNTransaction.Commit(); }); SCNTransaction.Commit(); } }
void ShowCodeExample(string code, string imageName, string extension) { SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 0; TextManager.FadeOutText(SlideTextManager.TextType.Code); if (code != null) { var codeNode = TextManager.AddCode(code); SCNVector3 min, max; min = new SCNVector3(0, 0, 0); max = new SCNVector3(0, 0, 0); codeNode.GetBoundingBox(ref min, ref max); if (imageName != null) { SCNNode imageNode = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Scenes/earth/" + imageName, extension), 4.0f, false); imageNode.Position = new SCNVector3(max.X + 2.5f, min.Y + 0.2f, 0); codeNode.AddChildNode(imageNode); max.X += 4.0f; } codeNode.Position = new SCNVector3(6 - (min.X + max.X) / 2, 10 - min.Y, 0); } SCNTransaction.Commit(); }
public override void WillOrderOut(PresentationViewController presentationViewController) { SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 0.75f; ChapterNode.Position = new SCNVector3(ChapterNode.Position.X - 30, ChapterNode.Position.Y, ChapterNode.Position.Z); SCNTransaction.Commit(); }
public override void PresentStep(int index, PresentationViewController presentationViewController) { SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 1; switch (index) { case 0: break; case 1: //add a plan in the background TextManager.FadeOutText(SlideTextManager.TextType.Code); TextManager.FadeOutText(SlideTextManager.TextType.Subtitle); var bg = SCNNode.Create(); var plane = SCNPlane.Create(100, 100); bg.Geometry = plane; bg.Position = new SCNVector3(0, 0, -60); presentationViewController.CameraNode.AddChildNode(bg); ((SCNView)presentationViewController.View).Scene.FogColor = NSColor.White; ((SCNView)presentationViewController.View).Scene.FogStartDistance = 10; ((SCNView)presentationViewController.View).Scene.FogEndDistance = 50; break; case 2: ((SCNView)presentationViewController.View).Scene.FogDensityExponent = 0.3f; break; } SCNTransaction.Commit(); }
public override void PresentStep(int index, PresentationViewController presentationViewController) { switch (index) { case 0: // Set the slide's title and subtitle and add some text. TextManager.SetTitle("Performance"); TextManager.SetSubtitle("Flattening"); TextManager.AddBulletAtLevel("Flatten node tree into single node", 0); TextManager.AddBulletAtLevel("Minimize draw calls", 0); TextManager.AddCode("#// Flatten node hierarchy \n" + "var flattenedNode = aNode.#FlattenedClone# ();#"); break; case 1: // Discard the text and show a 2D image. // Animate the image's position when it appears. TextManager.FlipOutText(SlideTextManager.TextType.Code); TextManager.FlipOutText(SlideTextManager.TextType.Bullet); var imageNode = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/flattening", "png"), 20, false); imageNode.Position = new SCNVector3(0, 4.8f, 16); GroundNode.AddChildNode(imageNode); SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 1; imageNode.Position = new SCNVector3(0, 4.8f, 8); SCNTransaction.Commit(); break; } }
public void HighlightBullet(int index) { // Highlight is done by changing the emission color var node = SubGroups [(int)TextType.Bullet]; if (node != null) { SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 0.75f; // Reset all foreach (SCNNode child in node.ChildNodes) { child.Geometry.FirstMaterial.Emission.Contents = NSColor.White; } // Unhighlight everything but index if (index > -1) { var i = 0; foreach (SCNNode child in node.ChildNodes) { if (i != index) { child.Geometry.FirstMaterial.Emission.Contents = NSColor.DarkGray; } i++; } } SCNTransaction.Commit(); } }
void PinchWithGestureRecognizer(UIPinchGestureRecognizer recognizer) { SCNTransaction.Begin(); SCNTransaction.AnimationTimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseOut); double fov = defaultFov; nfloat constraintFactor = 0; if (recognizer.State == UIGestureRecognizerState.Ended || recognizer.State == UIGestureRecognizerState.Cancelled) { SCNTransaction.AnimationDuration = 0.5; } else { SCNTransaction.AnimationDuration = 0.1; if (recognizer.Scale > 1) { nfloat scale = 1f + (recognizer.Scale - 1f) * 0.75f; //make pinch smoother fov *= 1 / scale; //zoom on pinch constraintFactor = NMath.Min(1f, (scale - 1f) * 0.75f); //focus on character when pinching } } PointOfView.Camera.XFov = fov; PointOfView.Constraints [0].InfluenceFactor = constraintFactor; SCNTransaction.Commit(); }
public override void WillOrderOut(PresentationViewController presentationViewController) { SCNTransaction.Begin(); // Restore the default point of view before leaving this slide ((SCNView)presentationViewController.View).PointOfView = presentationViewController.CameraNode; SCNTransaction.Commit(); }
public override void WillOrderOut(PresentationViewController presentationViewController) { SCNTransaction.Begin(); // Switch the light off LightNode.Light = null; SCNTransaction.Commit(); }
private void Open() { if (IsOpen || IsAnimating) { return; } // Open animation SCNTransaction.Begin(); SCNTransaction.AnimationTimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseOut); SCNTransaction.AnimationDuration = AnimationDuration / 4f; FocusSquareNode().Opacity = 1.0f; foreach (var segment in Segments) { segment.Open(); } SCNTransaction.SetCompletionBlock(() => { FocusSquareNode().RunAction(PulseAction(), "pulse"); }); SCNTransaction.Commit(); // Scale/bounce animation SCNTransaction.Begin(); SCNTransaction.AnimationTimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseOut); SCNTransaction.AnimationDuration = AnimationDuration / 4f; FocusSquareNode().SetUniformScale(FocusSquareSize); SCNTransaction.Commit(); IsOpen = true; }
public override void PresentStep(int index, PresentationViewController presentationViewController) { SCNTransaction.Begin(); switch (index) { case 0: break; case 1: // Switch to camera1 SCNTransaction.AnimationDuration = 2.0f; ((SCNView)presentationViewController.View).PointOfView = ContentNode.FindChildNode("camera1", true); break; case 2: // Switch to camera2 SCNTransaction.AnimationDuration = 2.0f; ((SCNView)presentationViewController.View).PointOfView = ContentNode.FindChildNode("camera2", true); break; case 3: // Switch back to the default camera SCNTransaction.AnimationDuration = 1.0f; ((SCNView)presentationViewController.View).PointOfView = presentationViewController.CameraNode; break; } SCNTransaction.Commit(); }
public override void PresentStep(int index, PresentationViewController presentationViewController) { // Set the slide's title TextManager.SetTitle ("Labs"); // Add two labs var lab1TitleNode = Utils.SCBoxNode ("Scene Kit Lab", new CGRect (-375, -35, 750, 70), NSColor.FromCalibratedWhite (0.15f, 1.0f), 0.0f, false); lab1TitleNode.Scale = new SCNVector3 (0.02f, 0.02f, 0.02f); lab1TitleNode.Position = new SCNVector3 (-2.8f, 30.7f, 10.0f); lab1TitleNode.Rotation = new SCNVector4 (1, 0, 0, (float)(Math.PI)); lab1TitleNode.Opacity = 0.0f; var lab2TitleNode = (SCNNode)lab1TitleNode.Copy (); lab2TitleNode.Position = new SCNVector3 (-2.8f, 29.2f, 10.0f); ContentNode.AddChildNode (lab1TitleNode); ContentNode.AddChildNode (lab2TitleNode); var lab1InfoNode = AddLabInfoNode ("\nGraphics and Games Lab A\nTuesday 4:00PM", 30.7f); var lab2InfoNode = AddLabInfoNode ("\nGraphics and Games Lab A\nWednesday 9:00AM", 29.2f); var delayInSeconds = 0.75; var popTime = new DispatchTime (DispatchTime.Now, (long)(delayInSeconds * Utils.NSEC_PER_SEC)); DispatchQueue.MainQueue.DispatchAfter (popTime, () => { SCNTransaction.Begin (); SCNTransaction.AnimationDuration = 1; lab1TitleNode.Opacity = lab2TitleNode.Opacity = 1.0f; lab1TitleNode.Rotation = lab2TitleNode.Rotation = new SCNVector4 (1, 0, 0, 0); lab1InfoNode.Opacity = lab2InfoNode.Opacity = 1.0f; lab1InfoNode.Rotation = lab2InfoNode.Rotation = new SCNVector4 (0, 1, 0, 0); SCNTransaction.Commit (); }); }
public override void WillOrderOut(PresentationViewController presentationViewController) { SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 1; presentationViewController.CameraNode.Constraints = new SCNConstraint[0]; presentationViewController.SpotLight.Constraints = new SCNConstraint[0]; SCNTransaction.Commit(); }
public override void PresentStep(int index, PresentationViewController presentationViewController) { SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 0; switch (index) { case 0: // Set the slide's title and subtile and add some text TextManager.SetTitle("Node Attributes"); TextManager.SetSubtitle("Lights"); TextManager.AddBulletAtLevel("SCNLight", 0); TextManager.AddBulletAtLevel("Four light types", 0); TextManager.AddBulletAtLevel("Omni", 1); TextManager.AddBulletAtLevel("Directional", 1); TextManager.AddBulletAtLevel("Spot", 1); TextManager.AddBulletAtLevel("Ambient", 1); break; case 1: // Add some code var codeExampleNode = TextManager.AddCode("#aNode.#Light# = SCNLight.Create (); \naNode.Light.LightType = SCNLightType.Omni;#"); codeExampleNode.Position = new SCNVector3(14, 11, 1); // Add a light to the scene LightNode = SCNNode.Create(); LightNode.Light = SCNLight.Create(); LightNode.Light.LightType = SCNLightType.Omni; LightNode.Light.Color = NSColor.Black; // initially off LightNode.Light.SetAttribute(new NSNumber(30), SCNLightAttribute.AttenuationStartKey); LightNode.Light.SetAttribute(new NSNumber(40), SCNLightAttribute.AttenuationEndKey); LightNode.Position = new SCNVector3(5, 3.5f, 0); ContentNode.AddChildNode(LightNode); // Load two images to help visualize the light (on and off) LightOffImageNode = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/light-off", "tiff"), 7, false); LightOnImageNode = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/light-on", "tiff"), 7, false); LightOnImageNode.Opacity = 0; LightNode.AddChildNode(LightOnImageNode); LightNode.AddChildNode(LightOffImageNode); break; case 2: // Switch the light on SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 1; LightNode.Light.Color = NSColor.FromCalibratedRgba(1, 1, 0.8f, 1); LightOnImageNode.Opacity = 1.0f; LightOffImageNode.Opacity = 0.0f; SCNTransaction.Commit(); break; } SCNTransaction.Commit(); }
public override void PresentStep(int index, PresentationViewController presentationViewController) { // Animate by default SCNTransaction.Begin(); switch (index) { case 0: // Disable animations for first step SCNTransaction.AnimationDuration = 0; // Initially dim the torus AnimatedNode.Opacity = 0.0f; TextManager.HighlightCodeChunks(null); break; case 1: TextManager.HighlightCodeChunks(new int[] { 0 }); break; case 2: TextManager.HighlightCodeChunks(new int[] { 1, 2, 3 }); break; case 3: TextManager.HighlightCodeChunks(new int[] { 4, 5 }); break; case 4: SCNTransaction.AnimationDuration = 1.0f; // Show the torus AnimatedNode.Opacity = 1.0f; // Animate explicitly var animation = CABasicAnimation.FromKeyPath("rotation"); animation.Duration = 2.0f; animation.To = NSValue.FromVector(new SCNVector4(0, 1, 0, (float)(Math.PI * 2))); animation.RepeatCount = float.MaxValue; AnimatedNode.AddAnimation(animation, new NSString("myAnimation")); SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 1; // Dim the text TextManager.TextNode.Opacity = 0.75f; presentationViewController.CameraHandle.Position = presentationViewController.CameraHandle.ConvertPositionToNode(new SCNVector3(9, 8, 15), presentationViewController.CameraHandle.ParentNode); presentationViewController.CameraPitch.Rotation = new SCNVector4(1, 0, 0, -(float)(Math.PI / 10)); SCNTransaction.Commit(); break; } SCNTransaction.Commit(); }
public override void PresentStep(int index, PresentationViewController presentationViewController) { SCNTransaction.Begin(); switch (index) { case 0: // Set the slide's title and subtitle and add some text TextManager.SetTitle("Skinning"); TextManager.AddBulletAtLevel("Animate characters", 0); TextManager.AddBulletAtLevel("Deform geometries with a skeleton", 0); TextManager.AddBulletAtLevel("Joints and bones", 0); // Animate the character CharacterNode.AddAnimation(IdleAnimationGroup, new NSString("idleAnimation")); // The character is hidden. Wait a little longer before showing it // otherwise it may slow down the transition from the previous slide var delayInSeconds = 1.5; var popTime = new DispatchTime(DispatchTime.Now, (long)(delayInSeconds * Utils.NSEC_PER_SEC)); DispatchQueue.MainQueue.DispatchAfter(popTime, () => { SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 0; CharacterNode.Hidden = false; CharacterNode.Opacity = 0; SCNTransaction.Commit(); SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 1.5; SCNTransaction.AnimationTimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseIn); CharacterNode.Opacity = 1; SCNTransaction.Commit(); }); break; case 1: SCNTransaction.AnimationDuration = 1.5f; //TODO SetShowsBones (true); break; case 2: CharacterNode.AddAnimation(AnimationGroup1, new NSString("animation")); break; case 3: SCNTransaction.AnimationDuration = 1.5f; //TODO SetShowsBones (false); break; case 4: CharacterNode.AddAnimation(AnimationGroup1, new NSString("animation")); break; } SCNTransaction.Commit(); }
void SetupCamera() { SCNNode pov = GameView.PointOfView; const float altitude = 1f; const float distance = 10f; cameraYHandle = SCNNode.Create(); cameraXHandle = SCNNode.Create(); cameraYHandle.Position = new SCNVector3(0f, altitude, 0f); cameraYHandle.AddChildNode(cameraXHandle); GameView.Scene.RootNode.AddChildNode(cameraYHandle); pov.EulerAngles = new SCNVector3(0f, 0f, 0f); pov.Position = new SCNVector3(0f, 0f, distance); cameraYHandle.Rotation = new SCNVector4(0f, 1f, 0f, (float)Math.PI / 2f + (float)Math.PI / 4f * 3f); cameraXHandle.Rotation = new SCNVector4(1f, 0f, 0f, -(float)Math.PI / 4f * 0.125f); cameraXHandle.AddChildNode(pov); // Animate camera on launch and prevent the user from manipulating the camera until the end of the animation lockCamera = true; SCNTransaction.Begin(); SCNTransaction.SetCompletionBlock(() => { lockCamera = false; }); var cameraYAnimation = CABasicAnimation.FromKeyPath("rotation.w"); cameraYAnimation.From = NSNumber.FromDouble(Math.PI * 2 - cameraYHandle.Rotation.W); cameraYAnimation.To = NSNumber.FromDouble(0.0); cameraYAnimation.Additive = true; cameraYAnimation.BeginTime = CAAnimation.CurrentMediaTime() + 3; cameraYAnimation.FillMode = CAFillMode.Both; cameraYAnimation.Duration = 5.0; cameraYAnimation.TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseInEaseOut); cameraYHandle.AddAnimation(cameraYAnimation, null); var cameraXAnimation = CABasicAnimation.FromKeyPath("rotation.w"); cameraXAnimation.From = NSNumber.FromDouble(-Math.PI / 2 + cameraXHandle.Rotation.W); cameraXAnimation.To = NSNumber.FromDouble(0.0); cameraXAnimation.Additive = true; cameraXAnimation.FillMode = CAFillMode.Both; cameraXAnimation.Duration = 5.0; cameraXAnimation.BeginTime = CAAnimation.CurrentMediaTime() + 3; cameraXAnimation.TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseInEaseOut); cameraXHandle.AddAnimation(cameraXAnimation, null); SCNTransaction.Commit(); var lookAtConstraint = SCNLookAtConstraint.Create(Character.Node.FindChildNode("Bip001_Head", true)); lookAtConstraint.InfluenceFactor = 0; pov.Constraints = new SCNConstraint[] { lookAtConstraint }; }
public override void WillOrderOut(PresentationViewController presentationViewController) { SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 0.5f; ((SCNView)presentationViewController.View).Scene.FogColor = NSColor.Black; ((SCNView)presentationViewController.View).Scene.FogEndDistance = 45.0f; ((SCNView)presentationViewController.View).Scene.FogDensityExponent = 1.0f; ((SCNView)presentationViewController.View).Scene.FogStartDistance = 40.0f; SCNTransaction.Commit(); }
private void Close(bool flash = false) { if (!IsOpen || IsAnimating) { return; } IsAnimating = true; StopPulsing(FocusSquareNode()); // Close animation SCNTransaction.Begin(); SCNTransaction.AnimationTimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseOut); SCNTransaction.AnimationDuration = AnimationDuration / 2f; FocusSquareNode().Opacity = 0.99f; SCNTransaction.SetCompletionBlock(() => { SCNTransaction.Begin(); SCNTransaction.AnimationTimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseOut); SCNTransaction.AnimationDuration = AnimationDuration / 4f; foreach (var segment in segments) { segment.Close(); } SCNTransaction.SetCompletionBlock(() => { IsAnimating = false; }); SCNTransaction.Commit(); }); SCNTransaction.Commit(); // Scale/bounce animation FocusSquareNode().AddAnimation(ScaleAnimation("transform.scale.x"), "transform.scale.y"); FocusSquareNode().AddAnimation(ScaleAnimation("transform.scale.y"), "transform.scale.y"); FocusSquareNode().AddAnimation(ScaleAnimation("transform.scale.z"), "transform.scale.z"); // Flash? if (flash) { var waitAction = SCNAction.Wait(AnimationDuration * 0.75f); var fadeInAction = SCNAction.FadeOpacityTo(0.25f, AnimationDuration * 0.125f); var fadeOutAction = SCNAction.FadeOpacityTo(0.0f, AnimationDuration * 0.125f); FillPlane.RunAction(SCNAction.Sequence(new SCNAction[] { waitAction, fadeInAction, fadeOutAction })); var flashSquareAction = FlashAnimation(AnimationDuration * 0.25f); foreach (var segment in Segments) { segment.RunAction(SCNAction.Sequence(new[] { waitAction, flashSquareAction })); } } IsOpen = false; }
public override void WillOrderOut(PresentationViewController presentationViewController) { // Reset the camera and lights before leaving this slide SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 2; presentationViewController.CameraNode.Camera.ZFar = 100.0f; SCNTransaction.Commit(); SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 0.5f; presentationViewController.RiseMainLight(false); SCNTransaction.Commit(); }
void SetPostGameFilters() { SCNTransaction.Begin(); desaturationTechnique.SetValueForKey(new NSNumber(1.0), (NSString)"Saturation"); SCNTransaction.AnimationDuration = 1.0; SCNTransaction.Commit(); SharedAppDelegate appDelegate = SharedAppDelegate.AppDelegate; appDelegate.Scene.Technique = desaturationTechnique; }
public override void DidOrderIn(PresentationViewController presentationViewController) { var diagramNode = SlideSceneGraph.SharedScenegraphDiagramNode(); SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 1.0f; diagramNode.Opacity = 1.0f; diagramNode.Rotation = new SCNVector4(1, 0, 0, 0); SlideSceneGraph.ShowNodesNamed(new string[] { "scene" }); SCNTransaction.Commit(); }
public override void PresentStep(int index, PresentationViewController presentationViewController) { SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 1.0f; switch (index) { case 0: break; } SCNTransaction.Commit(); }
public override void WillOrderOut(PresentationViewController presentationViewController) { // Remove the animation from the camera and restore (animate) its position before leaving this slide SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 0; presentationViewController.CameraNode.RemoveAnimation(new NSString("myAnim")); presentationViewController.CameraNode.Position = presentationViewController.CameraNode.PresentationNode.Position; SCNTransaction.Commit(); SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 1; presentationViewController.CameraNode.Position = new SCNVector3(0, 0, 0); SCNTransaction.Commit(); }
public override void DidOrderIn(PresentationViewController presentationViewController) { // Bring up a screenshot of the editor var editorScreenshotNode = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/editor", "png"), 14, true); editorScreenshotNode.Position = new SCNVector3(17, 4.1f, 5); editorScreenshotNode.Rotation = new SCNVector4(0, 1, 0, -(float)(Math.PI / 1.5f)); GroundNode.AddChildNode(editorScreenshotNode); // Animate it (rotate and move) SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 1; editorScreenshotNode.Position = new SCNVector3(7.5f, 4.1f, 5); editorScreenshotNode.Rotation = new SCNVector4(0, 1, 0, -(float)(Math.PI / 6.0f)); SCNTransaction.Commit(); }
void RemoveNumberNodes() { // Move, fade and remove on completion foreach (var node in GroundNode.ChildNodes) { if (node.Name == "number") { SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 1; SCNTransaction.SetCompletionBlock(node.RemoveFromParentNode); node.Opacity = 0.0f; node.Position = new SCNVector3(node.Position.X, node.Position.Y, node.Position.Z - 20); SCNTransaction.Commit(); } } }
public override void DidOrderIn (PresentationViewController presentationViewController) { // Bring up a screenshot of the editor var editorScreenshotNode = Utils.SCPlaneNode (NSBundle.MainBundle.PathForResource ("Images/particleEditor", "png"), 14, true); editorScreenshotNode.Geometry.FirstMaterial.Diffuse.MipFilter = SCNFilterMode.Linear; editorScreenshotNode.Position = new SCNVector3 (17, 3.8f, 5); editorScreenshotNode.Rotation = new SCNVector4 (0, 1, 0, -(float)Math.PI / 1.5f); GroundNode.AddChildNode (editorScreenshotNode); // Animate it (rotate and move) SCNTransaction.Begin (); SCNTransaction.AnimationDuration = 1; editorScreenshotNode.Position = new SCNVector3 (7, 3.8f, 5); editorScreenshotNode.Rotation = new SCNVector4 (0, 1, 0, -(float)Math.PI / 7); SCNTransaction.Commit (); }
// Animate (fade out) to remove the text of specified type public void FadeOutText(TextType type) { var node = SubGroups [(int)type]; SubGroups [(int)type] = null; if (node != null) { SCNTransaction.Begin(); SCNTransaction.AnimationDuration = FLIP_DURATION; SCNTransaction.SetCompletionBlock(node.RemoveFromParentNode); node.Opacity = 0; SCNTransaction.Commit(); // Reset the baseline to what it was before adding this text CurrentBaseline = Math.Max(CurrentBaseline, BaselinePerType [(int)type]); } }