SVGAnimatedNumber.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2023, MacDue <macdue@dueutil.tech>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/Bindings/PlatformObject.h>
  8. #include <LibWeb/WebIDL/ExceptionOr.h>
  9. namespace Web::SVG {
  10. // https://www.w3.org/TR/SVG11/types.html#InterfaceSVGAnimatedNumber
  11. class SVGAnimatedNumber final : public Bindings::PlatformObject {
  12. WEB_PLATFORM_OBJECT(SVGAnimatedNumber, Bindings::PlatformObject);
  13. JS_DECLARE_ALLOCATOR(SVGAnimatedNumber);
  14. public:
  15. [[nodiscard]] static JS::NonnullGCPtr<SVGAnimatedNumber> create(JS::Realm&, float base_val, float anim_val);
  16. virtual ~SVGAnimatedNumber() override;
  17. float base_val() const { return m_base_val; }
  18. float anim_val() const { return m_anim_val; }
  19. void set_base_val(float base_val) { m_base_val = base_val; }
  20. void set_anim_val(float anim_val) { m_anim_val = anim_val; }
  21. private:
  22. SVGAnimatedNumber(JS::Realm&, float base_val, float anim_val);
  23. virtual void initialize(JS::Realm&) override;
  24. float m_base_val;
  25. float m_anim_val;
  26. };
  27. }