예제 #1
0
            /**
             * @param motionImitator
             *      maps an event to a {@link com.facebook.rebound.Spring}
             * @param viewProperty
             *      the {@link android.view.View} property to animate
             * @param springListener
             *      additional listener to attach
             * @return the builder for chaining
             */

            public Builder AddMotion(MotionImitator motionImitator,
                                     Android.Util.Property viewProperty,
                                     ISpringListener springListener)
            {
                return(AddMotion(mSpringSystem.CreateSpring(), motionImitator,
                                 new Performer[] { new Performer(viewProperty) },
                                 new ISpringListener[] { springListener }));
            }
예제 #2
0
            /**
             * Creations a new motion object.
             *
             * @param spring
             *      the spring to use
             * @param motionProperties
             *      the properties of the event to track
             * @param springListeners
             *      additional spring listeners to add
             * @param trackStrategy
             *      the tracking strategy
             * @param followStrategy
             *      the follow strategy
             * @param restValue
             *      the spring rest value
             * @return a motion object
             */

            private Motion CreateMotionFromProperties(Spring spring,
                                                      MotionProperty[] motionProperties,
                                                      ISpringListener[] springListeners,
                                                      int trackStrategy, int followStrategy,
                                                      int restValue)
            {
                MotionImitator[] motionImitators = new MotionImitator[motionProperties.Length];
                Performer[]      performers      = new Performer[motionProperties.Length];

                for (int i = 0; i < motionProperties.Length; i++)
                {
                    MotionProperty property = motionProperties[i];

                    motionImitators[i] = new MotionImitator(spring, property, restValue, trackStrategy, followStrategy);
                    performers[i]      = new Performer(mView, property.ViewProperty);
                }

                return(new Motion(spring, motionImitators, performers, springListeners));
            }