PHP code example of ken / sweetanimation

1. Go to this page and download the library: Download ken/sweetanimation library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ken / sweetanimation example snippets


Ken\Sweetanimation\Provider\SpiderServiceProvider::class,

'Sweet' => Ken\Sweetanimation\Facades\Sweetanimation::class,

animation()->flash('Welcome back!', 'success');

@if (animation()->ready())
    <div class="alert-box {{ sweet()->type() }}">
        {{ animation()->message() }}
    </div>
@endif

animation()->flash('Welcome back!', 'success', [
    'timer' => 3000,
    'text' => 'It\'s really great to see you again',
    'animate' => 'flash'
]);
javascript
@if (animation()->ready())
    <script>
        swal({
            title: "{!! animation()->message() !!}",
            text: "{!! animation()->option('text') !!}",
            type: "{{ animation()->type() }}",
            @if (animation()->option('timer'))
                timer: {{ animation()->option('timer') }},
                showConfirmButton: false,
            @endif
            @if (animation()->option('animate'))
                animation: false,
                customClass: "animated {!! animation()->option('animate') !!}",
                showConfirmButton: true // optional
            @endif
        });
    </script>
@endif