Example #1
0
    public bool AnimateTo(Rect frame, float duration, float delay = 0f, Action completionHandler = null)
    {
        string identifier = Guid.NewGuid().ToString();
        bool   flag       = UniWebViewInterface.AnimateTo(this.listener.Name, (int)frame.x, (int)frame.y, (int)frame.width, (int)frame.height, duration, delay, identifier);

        if (flag)
        {
            this.frame = frame;
            if (completionHandler != null)
            {
                this.actions.Add(identifier, completionHandler);
            }
        }
        return(flag);
    }
Example #2
0
    /// <summary>
    /// Animates the web view from current position and size to another position and size.
    /// </summary>
    /// <param name="frame">The new `Frame` which the web view should be.</param>
    /// <param name="duration">Duration of the animation.</param>
    /// <param name="delay">Delay before the animation begins. Default is `0.0f`, which means the animation will start immediately.</param>
    /// <param name="completionHandler">Completion handler which will be called when animation finishes. Default is `null`.</param>
    /// <returns></returns>
    public bool AnimateTo(Rect frame, float duration, float delay = 0.0f, Action completionHandler = null)
    {
        var identifier       = Guid.NewGuid().ToString();
        var animationStarted = UniWebViewInterface.AnimateTo(listener.Name,
                                                             (int)frame.x, (int)frame.y, (int)frame.width, (int)frame.height, duration, delay, identifier);

        if (animationStarted)
        {
            this.frame = frame;
            if (completionHandler != null)
            {
                actions.Add(identifier, completionHandler);
            }
        }
        return(animationStarted);
    }