Nectar Documentation
DemoBuy Now
  • Introduction
  • Getting Started
    • Requirements
    • Installation
    • Directory Structure
    • Dependencies & Plugins
  • Basics
    • Configuration
    • Routes
    • Layout
    • Navigation
    • Initialization
    • Theming
    • Internationalization
    • Store Management
  • UI & UX
    • Components
      • Accordion
      • Action Sheet
      • Audio
      • Autocomplete
      • Badge
      • Breadcrumb
      • Button
      • Card
      • Chart
      • Checkbox
      • Chip
      • Color Picker
      • Content Block
      • Data Table
      • Date-Time Picker
      • Dialog
      • Dropcap
      • Elevation
      • Embed
      • Empty State
      • Expandable Card
      • Flip Card
      • Floating Action Button
      • Form Input
      • Form Validator
      • Gauge
      • Grid
      • Icon
      • Image
      • Image Compare
      • Image Hotspot
      • Infinite Scroll
      • Keypad
      • Line Divider
      • List Index
      • List View
      • Marquee
      • Menu
      • Menu List
      • Navbar
      • Note
      • Notification
      • Pagination
      • Photo Browser
      • Picker
      • Popover
      • Popup
      • Preloader
      • Progress Bar
      • Pull-to-Refresh
      • Quote
      • Radio
      • Range Slider
      • Rating
      • Ribbon
      • Searchbar
      • Sheet Modal
      • Show More/Less
      • Side Panel
      • Signature Pad
      • Skeleton
      • Smart Select
      • Sortable List
      • Stepper
      • Subnavbar
      • Swipeout
      • Swiper Slider
      • Syntax Highlighter
      • Tab
      • Text Editor
      • Timeline
      • Timer
      • Toast
      • Toggle
      • Toolbar
      • Tooltip
      • Tour Guide
      • Tree View
      • Video
      • Virtual List
    • Screens
      • Splash Screen
  • Advanced
    • Web APIs
      • App Badging API
      • App Shortcuts API
      • Battery Status API
      • Clipboard API
      • Contact Picker API
      • Device Memory API
      • Device Orientation API
      • File API
      • Fullscreen API
      • Geolocation API
      • Get Installed Related Apps API
      • HTML Media Capture API
      • Local Storage API
      • Network Information API
      • Notifications API
      • Online & Offline Status API
      • Page Visibility API
      • Permissions API
      • Picture-In-Picture API
      • Quota Estimation API
      • Screen Orientation API
      • Screen Wake Lock API
      • Server-Sent Events API
      • Session Storage API
      • Vibration API
      • Web Share API
    • Cordova Plugins
      • Battery Status
      • Build Info
      • Camera
      • Contacts Info
      • Device
      • Dialogs
      • Fingerprint Authentication
      • Geolocation
      • In-App Browser
      • Media Capture
      • Network Information
      • Social Sharing
      • Splash Screen
      • SQLite
      • Status Bar
      • Vibration
    • Integrations
      • AlaSQL
      • Disqus
      • Embedly
      • Facebook Comments
      • Google AdMob
      • Google Maps
      • Google Sheets
      • Gravatar
      • Lottie
      • Mailchimp
      • QR Code
      • RSS
      • Telegram Comments
      • WordPress
      • YouTube
  • Publishing
    • Progressive Web App
    • Cordova App
  • Help
    • Changelog
    • Support
    • Customization
  • Tutorials
    • How to Create and Animate an SVG Image Using JavaScript
Powered by GitBook
On this page
  • Install Inkscape
  • Create a New SVG
  • Add Text
  • Convert Text to Path
  • Ungroup Letters
  • Apply Dynamic Offset
  • Save the SVG
  • Optimize the SVG
  • Download Optimized SVG
  • Copy SVG Code
  • Update Splash Screen Page
  • Add Class to SVG
  • Add Stroke to Paths
  • Set Animation Duration
  1. Tutorials

How to Create and Animate an SVG Image Using JavaScript

PreviousCustomization

Last updated 28 days ago

Install Inkscape

Download and install Inkscape, a free SVG editing tool, from .

Create a New SVG

Launch Inkscape. A blank document will open automatically.

Add Text

Select the Text tool from the left sidebar. Type your desired text, and adjust its font, size, and color.

(Example: The Nectar logo uses the "Georgia" font.)

Convert Text to Path

Select the text object. To make it animatable with JavaScript, you must convert it into paths: Go to Path > Object to Path or press Shift + Ctrl + C.

Ungroup Letters

Ungroup the newly created paths: Go to Object > Ungroup or press Shift + Ctrl + G.

Apply Dynamic Offset

Select all the individual letter paths and press Ctrl + J to apply Dynamic Offset.

Save the SVG

Save your work as an SVG file.

Optimize the SVG

  • Uncheck: Show original, Merge paths, Move attributes to parent group, Prefer viewBox to width/height, Remove viewBox.

  • Keep all other settings checked.

Download Optimized SVG

After optimization, download the minimized SVG file.

Copy SVG Code

Open the optimized SVG file in a text editor and copy its entire content.

Update Splash Screen Page

Open the file /www/partials/screens/splash.html in your project. Locate the two <svg> elements (one for light mode and one for dark mode) and replace their contents with your copied SVG code.

Add Class to SVG

Add class="logo" to the <svg> element.

Add Stroke to Paths

Inside the SVG, find all the <path> elements. Each <path> will have a fill attribute (e.g., fill="#000000"). You must also add a stroke attribute with a color of your choice (e.g., stroke="#000000").

Set Animation Duration

Adjust the animation duration by changing:

let animationDuration = 2000;

Set it according to how fast or slow you want the animation to play.

That’s it! Your animated SVG is now ready to use! 🚀

Visit , upload your SVG file, and set the following options:

https://inkscape.org
SVGOMG