public void Register(Animatable animatable) { lock (_animatables) { _animatables.Add(animatable); } }
public Plugin(Animatable a) : base(a) { className = a.ClassName; cid = a.ClassID; scid = a.SuperClassID; ReferenceTarget rt = a as ReferenceTarget; var pbs = new List<ParameterBlock>(); if (rt == null) { targets = new Reference[0]; } else { targets = new Reference[rt.NumTargets]; for (int i = 0; i < rt.NumTargets; ++i) { var target = rt.GetTarget(i); targets[i] = new Reference(target); if (target is ParameterBlock1) { pbs.Add(new ParameterBlock(target as ParameterBlock1)); } else if (target is ParameterBlock2) { pbs.Add(new ParameterBlock(target as ParameterBlock2)); } } } paramblocks = pbs.ToArray(); }
public override int GetHashCode() { unchecked { IAnimatable target; if (!Animatable.TryGetTarget(out target)) { return(Handle?.GetHashCode() ?? 0); } return(((target?.GetHashCode() ?? 0) * 397) ^ (Handle?.GetHashCode() ?? 0)); } }
public static void Animate <T> (this Animatable self, string name, Func <float, T> transform, Action <T> callback, uint rate = 16, uint length = 250, Func <float, float> easing = null, Action <T, bool> finished = null, Func <bool> repeat = null) { if (transform == null) { throw new ArgumentNullException("transform"); } if (callback == null) { throw new ArgumentNullException("callback"); } if (self == null) { throw new ArgumentNullException("widget"); } self.AbortAnimation(name); name += self.GetHashCode().ToString(); Action <float> step = f => callback(transform(f)); Action <float, bool> final = null; if (finished != null) { final = (f, b) => finished(transform(f), b); } var info = new Info { Rate = rate, Length = length, Easing = easing ?? Easing.Linear }; Tweener tweener = new Tweener(info.Length, info.Rate); tweener.Easing = info.Easing; tweener.Handle = name; tweener.ValueUpdated += HandleTweenerUpdated; tweener.Finished += HandleTweenerFinished; info.tweener = tweener; info.callback = step; info.finished = final; info.repeat = repeat ?? (() => false); info.Owner = self; animations[name] = info; tweener.Start(); info.callback(0.0f); }
public TrimPath( string name, string matchName, TrimType trimPathType, Animatable <double> startPercent, Animatable <double> endPercent, Animatable <double> offsetDegrees) : base(name, matchName) { TrimPathType = trimPathType; StartPercent = startPercent; EndPercent = endPercent; OffsetDegrees = offsetDegrees; }
public RepeaterTransform( string name, IAnimatableVector3 anchor, IAnimatableVector3 position, IAnimatableVector3 scalePercent, Animatable <double> rotationDegrees, Animatable <double> opacityPercent, Animatable <double> startOpacityPercent, Animatable <double> endOpacityPercent) : base(name, anchor, position, scalePercent, rotationDegrees, opacityPercent) { StartOpacityPercent = startOpacityPercent; EndOpacityPercent = endOpacityPercent; }
XObject FromAnimatable <T>(string name, Animatable <T> animatable) where T : IEquatable <T> { if (!animatable.IsAnimated) { return(new XAttribute(name, $"{animatable.InitialValue}")); } else { var keyframesString = string.Join(", ", animatable.KeyFrames.SelectToSpan(kf => $"{FromKeyFrame(kf)}").ToArray()); return(new XElement(name, keyframesString)); } }
private void Start() { Damagable damagable = GetComponent <Damagable>(); BlockLevel level = FindObjectOfType <BlockLevel>(); Audible audible = GetComponent <Audible>(); damagable.RegisterOnKilled((d) => audible.playSound()); damagable.RegisterOnKilled((d) => level.removeBlock(d)); Animatable animatable = GetComponent <Animatable>(); damagable.RegisterOnDamaged((healthRemaining) => animatable.changeSprite(healthRemaining)); }
public LinearGradientFill( string name, string matchName, Animatable <double> opacityPercent, Animatable <Vector2> startPoint, Animatable <Vector2> endPoint, Animatable <Sequence <GradientStop> > gradientStops) : base(name, matchName) { OpacityPercent = opacityPercent; StartPoint = startPoint; EndPoint = endPoint; GradientStops = gradientStops; }
public Mask( bool inverted, string name, Animatable <PathGeometry> points, Animatable <Opacity> opacity, MaskMode mode ) { Inverted = inverted; Name = name; Points = points; Opacity = opacity; Mode = mode; }
public bool Equals(Animatable <T> x, Animatable <T> y) { if (ReferenceEquals(x, y)) { return(true); } if (x is null || y is null) { return(false); } return(x.InitialValue.Equals(y.InitialValue) && x.KeyFrames.SequenceEqual(y.KeyFrames)); }
public Rectangle( string name, string matchName, bool direction, IAnimatableVector3 position, IAnimatableVector3 size, Animatable <double> cornerRadius) : base(name, matchName) { Direction = direction; Position = position; Size = size; CornerRadius = cornerRadius; }
public Mask( bool inverted, string name, Animatable <Sequence <BezierSegment> > points, Animatable <double> opacityPercent, MaskMode mode ) { Inverted = inverted; Name = name; Points = points; OpacityPercent = opacityPercent; Mode = mode; }
public void AnimatableGetPropertyCount() { tlog.Debug(tag, $"AnimatableGetPropertyCount START"); var testingTarget = new Animatable(); Assert.IsNotNull(testingTarget, "should be not null"); Assert.IsInstanceOf <Animatable>(testingTarget, "should be an instance of Animatable class!"); tlog.Debug(tag, "PropertyCount : " + testingTarget.GetPropertyCount()); testingTarget.Dispose(); tlog.Debug(tag, $"AnimatableGetPropertyCount END (OK)"); }
public override IDisposable Apply(Animation animation, Animatable control, IClock clock, IObservable <bool> match, Action onComplete) { foreach (var keyframe in this) { if (keyframe.Value as ISolidColorBrush == null) { return(Disposable.Empty); } // Preprocess keyframe values to Color if the xaml parser converts them to ISCB. if (keyframe.Value.GetType() == typeof(ImmutableSolidColorBrush)) { keyframe.Value = ((ImmutableSolidColorBrush)keyframe.Value).Color; } } // Add SCB if the target prop is empty. if (control.GetValue(Property) == null) { control.SetValue(Property, new SolidColorBrush(Colors.Transparent)); } var targetVal = control.GetValue(Property); // Continue if target prop is not empty & is a SolidColorBrush derivative. if (typeof(ISolidColorBrush).IsAssignableFrom(targetVal.GetType())) { if (_colorAnimator == null) { InitializeColorAnimator(); } SolidColorBrush finalTarget; // If it's ISCB, change it back to SCB. if (targetVal.GetType() == typeof(ImmutableSolidColorBrush)) { var col = (ImmutableSolidColorBrush)targetVal; targetVal = new SolidColorBrush(col.Color); control.SetValue(Property, targetVal); } finalTarget = targetVal as SolidColorBrush; return(_colorAnimator.Apply(animation, finalTarget, clock ?? control.Clock, match, onComplete)); } return(Disposable.Empty); }
public Transform( string name, IAnimatableVector3 anchor, IAnimatableVector3 position, IAnimatableVector3 scalePercent, Animatable <double> rotationDegrees, Animatable <double> opacityPercent) : base(name, string.Empty) { Anchor = anchor; Position = position; ScalePercent = scalePercent; RotationDegrees = rotationDegrees; OpacityPercent = opacityPercent; }
/// <summary> /// Manager on message queued. /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The <see cref="NotificationMessageManagerEventArgs"/> instance containing the event data.</param> /// <exception cref="InvalidOperationException">Can't use both ItemsSource and Items collection at the same time.</exception> private void ManagerOnOnMessageQueued(object sender, NotificationMessageManagerEventArgs args) { (Items as AvaloniaList <object>).Add(args.Message); if (args.Message is INotificationAnimation animatableMessage && animatableMessage.AnimatableElement != null) { var animation = animatableMessage.AnimationOut; animation.Delay = TimeSpan.FromSeconds(0); animation.Duration = TimeSpan.FromSeconds(animatableMessage.AnimationOutDuration); Animatable animatable = animatableMessage.AnimatableElement as Animatable; animation.RunAsync(animatable); } }
Animatable StationaryObject() { if (numObjInMovement < targets.Length) { while (true) { Animatable target = targets[Random.Range(0, targets.Length)]; if (target.velocity.sqrMagnitude < float.Epsilon) { return(target); } } } return(null); }
Animatable StationaryObject() { if (numObjInMovement < targets.Length) { while (true) { Animatable target = targets[Random.Range(0, targets.Length)]; if (target.stationary) { return(target); } } } return(null); }
static Animatable <bool> FlipBoolAnimatable(Animatable <bool> animatable) { if (!animatable.IsAnimated) { return(new Animatable <bool>(!animatable.InitialValue)); } var keyFrames = new List <KeyFrame <bool> >(); foreach (var keyFrame in animatable.KeyFrames) { keyFrames.Add(new KeyFrame <bool>(keyFrame.Frame, !keyFrame.Value, keyFrame.Easing)); } return(new Animatable <bool>(!animatable.InitialValue, keyFrames)); }
public GaussianBlurEffect( string name, bool isEnabled, Animatable <double> blurriness, Animatable <Enum <BlurDimension> > blurDimensions, Animatable <bool> repeatEdgePixels, bool?forceGpuRendering) : base( name, isEnabled) { Blurriness = blurriness; BlurDimensions = blurDimensions; RepeatEdgePixels = repeatEdgePixels; ForceGpuRendering = forceGpuRendering; }
public void ChildPropertyRegistrationcConstructor() { tlog.Debug(tag, $"ChildPropertyRegistrationcConstructor START"); using (Animatable ani = new Animatable()) { var registered = new TypeRegistration((global::System.IntPtr)ani.SwigCPtr, false); var testingTarget = new ChildPropertyRegistration(registered, "Animatable", 45000000, PropertyType.Boolean); Assert.IsNotNull(testingTarget, "should not be null."); Assert.IsInstanceOf <ChildPropertyRegistration>(testingTarget, "should be an instance of ChildPropertyRegistration class!"); testingTarget.Dispose(); } tlog.Debug(tag, $"ChildPropertyRegistrationcConstructor END (OK)"); }
Animatable CreateObject() { Animatable target = targets[0]; // Determine position var entryAngle = objectAngle.RandomValue(); var objectPos = CameraHelper.WorldRect.RandomPosition(); var animatable = GameObject.Instantiate<Animatable>(target, objectPos, Quaternion.Euler(0, 0, entryAngle)); animatable.transform.parent = transform; animatable.localScale = RandomHelper.RandomVector2(minObjectSize, maxObjectSize); return animatable; }
private void ChangeBobText() { String randombobtext = ChooseRandomBobText(); Bitmap measurebob = new Bitmap(1, 1); Font bobberfont = new Font("Arial", 72, FontStyle.Bold); Graphics mbob = Graphics.FromImage(measurebob); SizeF bobtextsize = mbob.MeasureString(randombobtext, bobberfont); Color RandomColor1 = getrndcolor(); Color RandomColor2 = getrndcolor(); float randomAngle = (float)(2 * Math.PI * rgen.NextDouble()); Brush bobtextbrush = new LinearGradientBrush(new RectangleF(0, 0, bobtextsize.Width, bobtextsize.Height), RandomColor1, RandomColor2, randomAngle, true); Bobber = (Animatable) new BobbingTextAnimator(randombobtext, 35, bobberfont, 0.25f, 0.35f, 0.007f, -35, bobtextbrush); }
// TODO // Add scale velocity to target IEnumerator Rescale(Animatable target) { yield return(new WaitForSeconds(startTime)); bool scaleUp = true; while (Time.time < endTime) { var reverseAt = Time.time + cadence; target.scaleVelocity = scaleUp ? scaleVelocity : -1 * scaleVelocity; while (Time.time < reverseAt) { yield return(null); } scaleUp = !scaleUp; } }
private static void BFS(Animatable o, int depth) { if (o == null) { Tizen.Log.Fatal("NUI-APP", "##### o == null! return here!"); return; } Tizen.Log.Fatal("NUI-APP", "##### o.GetTypeName()=" + o.GetTypeName()); if (o is View) { View myView = o as View; if (o is TextLabel) { TextLabel myTextLabel = o as TextLabel; Tizen.Log.Fatal("NUI-APP", string.Format("it is TextLabel, {0}", myTextLabel.Text)); return; } else { Tizen.Log.Fatal("NUI-APP", string.Format("it is not TextLaebl")); } for (int i = 0; i < myView.ChildCount; i++) { BFS(myView.GetChildAt((uint)i), depth + 1); } } else if (o is Layer) { Layer myLayer = o as Layer; for (int i = 0; i < myLayer.ChildCount; i++) { BFS(myLayer.GetChildAt((uint)i), depth + 1); } } else { return; } }
public void ParentTest() { tlog.Debug(tag, $"ParentTest START"); try { Animatable t2 = new Animatable(); Assert.IsNotNull(t2, "null Element"); Assert.IsNull(t2.Parent, "Should be null"); t2.Parent = new View(); Assert.IsNotNull(t2.Parent, "Should not be null"); } catch (Exception e) { Assert.Fail("Caught Exception" + e.ToString()); } tlog.Debug(tag, $"ParentTest END"); }
/*private List<Tuple<IAnimatable, DependencyProperty>> animatedPropertyList = * new List<Tuple<IAnimatable, DependencyProperty>>();*/ /// <summary> /// アニメーションを開始します。 /// </summary> public void Begin(Animatable target) { foreach (var anim in Children) { if (anim == null) { continue; } var animTarget = GetTarget(anim); if (animTarget == null) { animTarget = target; var targetPath = GetTargetPath(anim); if (!string.IsNullOrEmpty(targetPath)) { var targetProperty = WPFUtil.GetDependencyProperty( target.GetType(), targetPath); if (targetProperty != null) { var t = target.GetValue(targetProperty) as Animatable; if (t != null) { animTarget = t; } } } } var property = WPFUtil.GetDependencyProperty( animTarget.GetType(), GetTargetProperty(anim)); if (property != null) { animTarget.BeginAnimation(property, anim); } /*this.animatedPropertyList.Add( * Tuple.Create(animTarget, property));*/ } }
public void RenderTaskAssign() { tlog.Debug(tag, $"RenderTaskAssign START"); using (Animatable ani = new Animatable()) { using (RenderTask task = new RenderTask(ani.SwigCPtr.Handle, false)) { var testingTarget = task.Assign(task); Assert.IsNotNull(testingTarget, "Can't create success object RenderTask."); Assert.IsInstanceOf <RenderTask>(testingTarget, "Should return RenderTask instance."); testingTarget.Dispose(); } } tlog.Debug(tag, $"RenderTaskAssign END (OK)"); }
public RadialGradientFill( string name, string matchName, Animatable <double> opacityPercent, IAnimatableVector3 startPoint, IAnimatableVector3 endPoint, Animatable <Sequence <GradientStop> > gradientStops, Animatable <double> highlightLength, Animatable <double> highlightDegrees) : base(name, matchName) { OpacityPercent = opacityPercent; StartPoint = startPoint; EndPoint = endPoint; GradientStops = gradientStops; HighlightLength = highlightLength; HighlightDegrees = highlightDegrees; }
public void RenderTaskRequiresSync() { tlog.Debug(tag, $"RenderTaskRequiresSync START"); using (Animatable ani = new Animatable()) { var testingTarget = new RenderTask(ani.SwigCPtr.Handle, false); Assert.IsNotNull(testingTarget, "Can't create success object RenderTask."); Assert.IsInstanceOf <RenderTask>(testingTarget, "Should return RenderTask instance."); testingTarget.RequiresSync = true; tlog.Debug(tag, "RequiresSync :" + testingTarget.RequiresSync); testingTarget.Dispose(); } tlog.Debug(tag, $"RenderTaskRequiresSync END (OK)"); }
public void PropertyConstructorWithPropertyName() { tlog.Debug(tag, $"PropertyConstructorWithPropertyName START"); var animatable = new Animatable(); Assert.IsNotNull(animatable, "Should be not null!"); Assert.IsInstanceOf <Animatable>(animatable, "Should return PropertyValue instance."); var testingTarget = new Property(animatable, "image"); Assert.IsNotNull(testingTarget, "Should be not null!"); Assert.IsInstanceOf <Property>(testingTarget, "Should return PropertyValue instance."); testingTarget.Dispose(); animatable.Dispose(); tlog.Debug(tag, $"PropertyConstructorWithPropertyName END (OK)"); }
protected override void CopyCurrentValueCore(Animatable sourceAnimatable) { base.CopyCurrentValueCore(sourceAnimatable); }
private void ChangeBobText() { String randombobtext = ChooseRandomBobText(); Bitmap measurebob = new Bitmap(1, 1); Font bobberfont = BCBlockGameState.GetScaledFont(new Font("Arial", 72, FontStyle.Bold),128); Graphics mbob = Graphics.FromImage(measurebob); SizeF bobtextsize = mbob.MeasureString(randombobtext, bobberfont); Color RandomColor1 = getrndcolor(); Color RandomColor2 = getrndcolor(); float randomAngle = (float) (2*Math.PI*rgen.NextDouble()); Brush bobtextbrush = new LinearGradientBrush(new RectangleF(0, 0, bobtextsize.Width, bobtextsize.Height), RandomColor1, RandomColor2, randomAngle, true); Bobber = (Animatable) new BobbingTextAnimator(randombobtext, 35, bobberfont, 0.25f, 0.35f, 0.007f, -35, bobtextbrush); }
private void SplashScreen_Load(object sender, EventArgs e) { //431, 260 createregunregimage(); chooseimage(); this.AllowTransparency = true; //first, initialize image panel to 431, 260 panImage.Location = new Point(0, 0); //change this if the image is changed... Size UseSize = new Size(431, 260); PointF ScaleValue = DPIHelper.GetDPIScaling(this); UseSize = new Size((int)((float)UseSize.Width*ScaleValue.X),(int)((float)UseSize.Height*ScaleValue.Y)); panImage.Size = UseSize; Size = new Size(panImage.Width, panImage.Height + panProgress.Height); //clear the background of the panImage to speed drawing //panImage.BackgroundImage=null; InitBackground(); //ImageBackBufferCanvas.DrawImage(useBackground, 0, 0, BackgroundBitmap.Width, BackgroundBitmap.Height); //move the lower pane... panProgress.Location = new Point(0, panImage.Bottom); panProgress.Size = new Size(panImage.Width, ClientSize.Height - panImage.Bottom); panProgress.Visible = !ShownAsAbout; PanelAbout.Visible = ShownAsAbout; PanelAbout.Size = panProgress.Size; if (ShownAsAbout) { LowerPanel = PanelAbout; PanelAbout.Visible = true; } else { LowerPanel = panProgress; } LowerPanel.Visible = true; LowerPanel.Location = new Point(0, panImage.Bottom); this.Size = new Size(panImage.Width, LowerPanel.Bottom); //resize the textbox to show exactly two lines //panProgress.Height = txtprogress.Height; //this.ClientSize = new Size(this.ClientSize.Width,panImage.Height + panProgress.Height); this.Height = LowerPanel.Bottom + 5; //put in middle of the screen, as well. //get appropriate screen... Screen usescreen = Screen.FromHandle(this.Handle); //center on working area... Point uselocation = new Point(usescreen.WorkingArea.Width/2 - Width/2, usescreen.WorkingArea.Height/2 - Height/2); this.Location = uselocation; mAlphaIncrement = 0.01; this.Opacity = 100; // Bobber = new BobbingTextAnimator("BETA", 35, new Font("Arial", 72,FontStyle.Bold),0.25f,0.35f,0.007f,-35); //Bobber = new BobbingTextAnimator(GetExecutingVersion(), 35, new Font("Arial", 72, FontStyle.Bold), 0.25f, 0.35f, 0.007f, -35); String randombobtext = ChooseRandomBobText(); Bitmap measurebob = new Bitmap(1, 1); Font bobberfont = BCBlockGameState.GetScaledFont(new Font("Arial", 72, FontStyle.Bold),90); Font biggerbobberfont = BCBlockGameState.GetScaledFont(new Font("Arial", 72, FontStyle.Bold), 128); Graphics mbob = Graphics.FromImage(measurebob); SizeF bobtextsize = mbob.MeasureString(randombobtext, bobberfont); Color RandomColor1 = getrndcolor(); Color RandomColor2 = getrndcolor(); float randomAngle = (float) (2*Math.PI*rgen.NextDouble()); Brush bobtextbrush = new LinearGradientBrush(new RectangleF(0, 0, bobtextsize.Width, bobtextsize.Height), RandomColor1, RandomColor2, randomAngle, true); FirstBobberPos = new Point((int)(320f*ScaleValue.X),(int)(157f*ScaleValue.Y)); SecondBobberPos = new Point((int)(70f * ScaleValue.X), (int)(157f * ScaleValue.Y)); Bobber = (Animatable) new BobbingTextAnimator(randombobtext, 35, bobberfont, 0.25f, 0.35f, 0.007f, -35, bobtextbrush); Bobber2 = (Animatable) new BobbingTextAnimator(GetExecutingVersion(), 35,biggerbobberfont, 0.25f, 0.35f, 0.007f, 32, new SolidBrush(Color.Yellow)); delaytimer = new Timer(timercallback, null, 0, 0); //alphatimer = new Timer(AlphaTick, null, 0, 10); tmrFade.Enabled = true; //BCBlockGameState.Initgamestate(this); assemblylist = new GenericListViewSorter(lvwAssemblies); }
public void Commit(Animatable owner, string name, uint rate = 16, uint length = 250, Func<double, double> easing = null, Action<double, bool> finished = null, Func<bool> repeat = null) { owner.Animate (name, this, rate, length, easing, finished, repeat); }
protected virtual void CopyCurrentValueCore(Animatable sourceAnimatable) { throw new NotImplementedException(); }
public Target(Animatable a) { id = (ulong)a.AnimHandle; }
public override void LoadAssets() { background = FullScreenQuad.create(this, "pedal_stomp_bg"); shoe = resourceFactory.Create("SceneTen/Shoe"); amp = resourceFactory.Create(this, "Amp"); wires = resourceFactory.Create(this, "Wires"); wireShadow = resourceFactory.Create(this, "WireShadow"); background.visible(false); shoe.SetActive(false); amp.SetActive(false); wires.SetActive(false); wireShadow.SetActive(false); // double the scale on all of these because the art is half-size shoe.transform.localScale = Vector3.one * 2; shoe.GetComponent<Sprite>().setScreenPosition(0, 164); amp.GetComponent<Sprite>().setScreenPosition(130, 50); amp.transform.localScale = Vector3.one * 2; wires.GetComponent<Sprite>().setScreenPosition(30, 30); wires.transform.localScale = Vector3.one * 2; wireShadow.GetComponent<Sprite>().setScreenPosition(30, 30); wireShadow.transform.localScale = Vector3.one * 2; pedalStomped = new PedalStomped(new List<Sprite> {ampSprite, wiresSprite, wireShadowSprite}); pedalUnStomped = new PedalUnStomped(new List<Sprite> {ampSprite, wiresSprite, wireShadowSprite}); stompFoot = new StompFoot(new List<Sprite> {shoeSprite}); retractFoot = new RetractFoot(new List<Sprite> {shoeSprite}); animatables = new[] {pedalStomped, pedalUnStomped, stompFoot, retractFoot}; }