Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(label animations): added pulse animation
- Loading branch information
Showing
3 changed files
with
90 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<?php | ||
|
||
namespace App\Actions\FontAwesome\v6; | ||
|
||
use Lorisleiva\Actions\Concerns\AsAction; | ||
|
||
class GetLabelAnimationMarkup | ||
{ | ||
use AsAction; | ||
|
||
public function handle(string $animation, string $animationDuration) | ||
{ | ||
if ($animation == 'blink') { | ||
return <<<EOD | ||
<style> | ||
@keyframes blink { | ||
0% { | ||
opacity: 1; | ||
} | ||
49% { | ||
opacity: 1; | ||
} | ||
50% { | ||
opacity: 0; | ||
} | ||
99% { | ||
opacity: 0; | ||
} | ||
100% { | ||
opacity: 1; | ||
} | ||
} | ||
@-webkit-keyframes blink { | ||
0% { | ||
opacity: 1; | ||
} | ||
49% { | ||
opacity: 1; | ||
} | ||
50% { | ||
opacity: 0; | ||
} | ||
99% { | ||
opacity: 0; | ||
} | ||
100% { | ||
opacity: 1; | ||
} | ||
} | ||
.labelAnimation { | ||
animation: blink {$animationDuration} linear infinite; | ||
-webkit-animation: blink {$animationDuration} linear infinite; | ||
} | ||
</style> | ||
EOD; | ||
} elseif ($animation == 'pulse') { | ||
return <<<EOD | ||
<style> | ||
@keyframes pulse { | ||
0% { | ||
opacity: 1.0; | ||
} | ||
25% { | ||
opacity: 1.0; | ||
} | ||
100% { | ||
opacity: 0.0; | ||
} | ||
} | ||
.labelAnimation { | ||
animation-name: pulse; | ||
animation-duration: {$animationDuration}; | ||
animation-iteration-count: infinite; | ||
animation-direction: alternate; | ||
} | ||
</style> | ||
EOD; | ||
} | ||
|
||
return ''; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters